package flc.ast.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

import flc.ast.R;
import flc.ast.bean.Image;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;

public class PictureChildAdapter extends StkProviderMultiAdapter<Image> {

    public PictureChildAdapter() {
        super(3);
        addItemProvider(new PictureChildItemProvider());
        notifyDataSetChanged();
    }

    private class PictureChildItemProvider extends BaseItemProvider<Image> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_picture_child;
        }

        @Override
        public void convert(@NotNull BaseViewHolder baseViewHolder, Image image) {
            ImageView ivPictureChildImage = baseViewHolder.getView(R.id.ivPictureChildImage);
            Glide.with(getContext())
                    .load(image.getPath())
                    .into(ivPictureChildImage);
        }
    }
}
